<?php
// +----------------------------------------------------------------------
// | OneKeyAdmin [ Believe that you can do better ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2023 http://onekeyadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: MUKE <513038996@qq.com>
// +----------------------------------------------------------------------
namespace plugins\pay\index\controller;

use think\facade\View;
use app\index\BaseController;
/**
 * 生成二维码
 */
class Qrcode extends BaseController
{
    public function index()
    {
        require_once dirname(dirname(dirname ( __FILE__ ))).'/addons/wechat/example/phpqrcode/phpqrcode.php';
        $url = urldecode($_GET["data"]);
        $path     = plugin_path() . 'pay/';
        $qrFile   = $path .'qrcode.png';//已经生成的原始二维码图
        \QRcode::png($url, $qrFile, 6, 6);
        //输出图片
        return json(['status'=>'success','message'=>'success','data'=>['url'=> 'https://www.tftcc.cn/plugins/pay/'.'qrcode.png']]);

    }
}